﻿using System;
using System.ComponentModel;

namespace DemoWPF
{
	public class Item : INotifyPropertyChanging, INotifyPropertyChanged
	{
		private string _Text;
		public string Text {
			get { return _Text; }
			set { if (_Text == value) return;
				OnPropertyChanging("Text");
				_Text = value;
				OnPropertyChanged("Text");
			}
		}
		
		public event PropertyChangingEventHandler PropertyChanging;
		
		protected virtual void OnPropertyChanging(string propertyName)
		{
			if (PropertyChanging != null) {
				PropertyChanging(this, new PropertyChangingEventArgs(propertyName));
			}
		}
		
		public event PropertyChangedEventHandler PropertyChanged;
		
		protected virtual void OnPropertyChanged(string propertyName)
		{
			if (PropertyChanged != null) {
				PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
			}
		}
	}
}
